// components/ordertab/ordertab.js
Component({
  /**
   * 组件的属性列表
   */
  height: {
    type: String,
    value: '64rpx'
  },
  color: {
    type: String,
    value: '#172991'
  },
  properties: {
    tabList: {
      type: Array,
      value: [
        { id: 1, text: '全部' },
        { id: 2, text: '立等可取' },
        { id: 3, text: '预约订单' },
      ]
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    lineHeight: '',
    active: 1
  },

  /**
   * 组件的方法列表
   */
  methods: {
    changeTab(e) {
      console.log(e.currentTarget.dataset.id);
      const id = e.currentTarget.dataset.id;
      this.setData({ active: id })
      // this.triggerEvent('changeTab', id);
    }
  },
  lifetimes: {
    attached() {
      this.setData({
        lineHeight: parseFloat(this.properties.height) - 4 + 'rpx'
      })
    }
  }
})

